<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
  <div v-if="items">
    <v-toolbar flat color="white">
      <v-app-bar-nav-icon @click="showDrawer()"></v-app-bar-nav-icon>
      <v-toolbar-title>Dashboard</v-toolbar-title>
      <v-spacer></v-spacer>
      <div>
        <v-tabs centered>
          <v-tab key="history" :to="`/project/${projectId}/history`">执行记录</v-tab>
          <v-tab key="activity" :to="`/project/${projectId}/activity`">操作记录</v-tab>
          <v-tab key="settings" :to="`/project/${projectId}/settings`">设置</v-tab>
        </v-tabs>
      </div>
    </v-toolbar>

    <v-data-table
      :headers="headers"
      :items="items"
      class="mt-4"
      :footer-props="{ itemsPerPageOptions: [20] }"
    >
      <template v-slot:item.created="{ item }">
        {{ item.created | formatDate }}
      </template>
    </v-data-table>
  </div>
</template>
<script>
import ItemListPageBase from '@/components/ItemListPageBase';

export default {
  mixins: [ItemListPageBase],

  methods: {
    getHeaders() {
      return [
        {
          text: '时间',
          value: 'created',
          sortable: false,
          width: '20%',
        },
        {
          text: '备注',
          value: 'description',
          sortable: false,
          width: '80%',
        },
      ];
    },

    getItemsUrl() {
      return `/api/project/${this.projectId}/events/last`;
    },
  },
};
</script>
